package com.cloud.service;

import com.cloud.common.domain.Result;
import com.cloud.entity.*;
import com.cloud.entity.vo.AuthParam;
import com.cloud.utils.ServiceConstants;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * Feign服务调用
 * 系统模块
 */
@Component
@FeignClient(value = ServiceConstants.TlxxModulesSystem)
public interface FeignSystemService {

    /**
     * 根据类型查询密钥信息
     */
    @LoadBalanced
    @RequestMapping(value = "/system/projectAuth/inAuth/selectProjectAuth")
    public Result<SysProjectAuth> selectProjectAuth(@SpringQueryMap SysProjectAuth projectAuth);

    /**
     * 添加操作日志
     */
    @LoadBalanced
    @PostMapping(value = "/system/operLogs/inAuth/saveOperLogs")
    public Result<Integer> saveOperLogs(@RequestBody SysOperLogs operLogs);

    /**
     * 查询配置参数
     */
    @LoadBalanced
    @RequestMapping(value = "/system/config/inAuth/getInConfig")
    public Result<String> getInConfig(@RequestParam(value = "configKey") String configKey);

    /**
     * 根据部门主键查询用户主键
     */
    @LoadBalanced
    @RequestMapping(value = "/system/user/inAuth/selectInUserIds")
    public Result<String> selectInUserIds(@RequestParam(value = "deptId") Long deptId);

    /**
     * 查询用户详细
     */
    @LoadBalanced
    @RequestMapping(value = "/system/user/inAuth/selectInUserInfo")
    public Result<SysUser> selectInUserInfo(@RequestParam(value = "userId") Long userId);

    /**
     * 根据ID查询子级部门主键列表
     */
    @LoadBalanced
    @RequestMapping(value = "/system/dept/inAuth/selectChildDeptId")
    public Result<List<Long>> selectChildDeptId(@RequestParam(value = "deptId") Long deptId);

    /**
     * 根据部门全称查询部门对象
     */
    @LoadBalanced
    @RequestMapping(value = "/system/dept/inAuth/getInDeptByName")
    public Result<SysDept> getInDeptByName(@RequestParam(value = "deptName") String deptName);

    /**
     * 根据部门id查询部门对象
     */
    @LoadBalanced
    @RequestMapping(value = "/system/dept/inAuth/getInDeptByDeptId")
    public Result<SysDept> getInDeptByDeptId(@RequestParam(value = "deptId") Long deptId);

    /**
     * 根据区域编号查询区域信息
     */
    @LoadBalanced
    @RequestMapping(value = "/system/deptArea/inAuth/getInDeptAreaByCode")
    public Result<SysDeptArea> getInDeptAreaByCode(@RequestParam(value = "areaCode") String areaCode);

    /**
     * 根据主键查询地区信息
     */
    @LoadBalanced
    @RequestMapping(value = "/system/deptArea/inAuth/selectAreaById")
    public Result<SysDeptArea> selectAreaById(@RequestParam(value = "areaId") Long areaId);

    /**
     * 根据部门ID查询地区信息
     */
    @LoadBalanced
    @RequestMapping(value = "/system/dept/inAuth/getInSuperAreaDept")
    public Result<SysDeptArea> getInSuperAreaDept(@RequestParam(value = "deptId") Long deptId);

    /**
     * 根据区域名称查询区域信息
     */
    @LoadBalanced
    @RequestMapping(value = "/system/deptArea/inAuth/getInAreaByName")
    public Result<SysDeptArea> getInAreaByName(@RequestParam(value = "areaName") String areaName);

    /**
     * 根据昵称或电话查询账户信息
     */
    @LoadBalanced
    @RequestMapping(value = "/system/user/inAuth/queryUserInfo")
    public Result<SysUser> queryUserInfo(@RequestParam(value = "phone") String phone);

    /**
     * 根据账号名称查询账户信息
     *
     * @param userName
     * @return
     */
    @LoadBalanced
    @RequestMapping(value = "/system/user/inAuth/getUserByName")
    public Result<SysUser> getUserByName(@RequestParam(value = "userName") String userName);

    /**
     * 根据类型获取授权ID列表
     */
    @LoadBalanced
    @RequestMapping(value = "/system/auth/getUserAuthIds")
    public Result<List<String>> getUserAuthIds(@SpringQueryMap AuthParam authParam);

    /**
     * 根据角色ID查询角色信息
     */
    @LoadBalanced
    @RequestMapping(value = "/system/role/inAuth/getInRoleInfo")
    public Result<SysRole> getInRoleInfo(@RequestParam(value = "roleId") Long roleId);

    /**
     * 根据部门id查询用户ids
     */
    @LoadBalanced
    @RequestMapping(value = "/system/dept/inAuth/getDeptUserIdsById")
    public Result<List<Long>> getDeptUserIdsById(@RequestParam(value = "deptIds") String deptIds);

    /**
     * 根据角色ID查询用户ids
     */
    @LoadBalanced
    @RequestMapping(value = "/system/role/inAuth/getRoleUserIdsById")
    public Result<List<Long>> getRoleUserIdsById(@RequestParam(value = "roleIds") String roleIds);

}
